<html>
<head>
<link rel="stylesheet" type="text/css" href="lib/css/main.css" />
<link rel="stylesheet" type="text/css" href="lib/css/drop.css" />
<script type="text/javascript" src="lib/js/main.js"></script>
<script type="text/javascript" src="lib/js/trucker_drop_ajax.js"></script>
<script type="text/javascript" src="lib/js/assignment_ajax.js"></script>
<script type="text/javascript" src="lib/js/disableDiv.js"></script>
<script type="text/javascript" src="lib/js/clock.js"></script>
<script type="text/javascript" src="lib/js/jquery-1.7.1.js"></script>

<link rel="stylesheet" href="lib/js/jqueryui/css/blitzer/jquery-ui-1.8.17.custom.css">
<!--<link rel="stylesheet" href="lib/js/jqueryui/css/ui-lightness/jquery-ui-1.8.17.custom.css">-->
<script type="text/javascript" src="lib/js/jqueryui/js/jquery-ui-1.8.17.custom.min.js"></script>

<script type="text/javascript">
function redirectFrame(frameId,location){
document.getElementById(frameId).src = location;
};

function ajaxLogout()
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="logout.php";
xmlhttp.onreadystatechange=scLogout;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function scLogout()
{
if (xmlhttp.readyState==4)
  {
	window.top.location = "login.html";
  }
}
function txtToDatePicker()
{
	$( "#txt_inc_date" ).datepicker();
	$( "#txt_inc_date" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );
}
function saveIncident()
{
	xmlhttp_incident2=GetXmlHttpObject();
	if (xmlhttp_incident2==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	var hf_trip_id = document.getElementById("hf_inc_trip_id").value;
	var inc_date = document.getElementById("txt_inc_date").value;
	var inc_time = document.getElementById("txt_inc_time").value;
	var inc_caller = document.getElementById("txt_inc_caller").value;
	var inc_mobile = document.getElementById("txt_inc_mobile").value;
	var inc_type = document.getElementById("txt_inc_type").value;
	var inc_location = document.getElementById("txt_inc_location").value;
	var inc_remarks = document.getElementById("txt_inc_remarks").value;
	var url="ajax_insert_incident.php";
	url=url+"?v0="+hf_trip_id;
	url=url+"&v1="+inc_date;
	url=url+"&v2="+inc_time;
	url=url+"&v3="+inc_caller;
	url=url+"&v4="+inc_mobile;
	url=url+"&v5="+inc_type;
	url=url+"&v6="+inc_location;
	url=url+"&v7="+inc_remarks;
	xmlhttp_incident2.onreadystatechange=function (){
	  if (xmlhttp_incident2.readyState==4)
	  {
		alert('Successfully added record!');
		document.getElementById('div_inc_list').innerHTML = xmlhttp_incident2.responseText;
		clearIncFields();
	  }
	}
	xmlhttp_incident2.open("GET",url,true);
	xmlhttp_incident2.send(null);	
}
function clearIncFields()
{
	document.getElementById("txt_inc_date").value="";
	document.getElementById("txt_inc_time").value="";
	document.getElementById("txt_inc_caller").value="";
	document.getElementById("txt_inc_mobile").value="";
	document.getElementById("txt_inc_type").value="";
	document.getElementById("txt_inc_location").value="";
	document.getElementById("txt_inc_remarks").value="";
}
function updateStatus(trip_id)
{
	var askUpdate = confirm("Click ok to update status.");
	if(askUpdate)
	{
		ajaxUpdateStatus(trip_id);
	}
}
function ajaxUpdateStatus(trip_id)
{
	xmlhttp_up_stat=GetXmlHttpObject();
	if (xmlhttp_up_stat==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	var url="ajax_update_status.php";
	url=url+"?id="+trip_id;
	xmlhttp_up_stat.onreadystatechange=function (){
	  if (xmlhttp_up_stat.readyState==4)
	  {
		redirectFrame("bodyFrame","dashboard.php")
		closePopDiv();
		alert('Successfully updated status!');
	  }
	}
	xmlhttp_up_stat.open("GET",url,true);
	xmlhttp_up_stat.send(null);	
}

function confirmTripAssignment(trip_id)
{
	var askConfirm = confirm("Click ok to confirm trip assignment.");
	if(askConfirm)
	{
		xmlhttp_confirm_assign=GetXmlHttpObject();
		if (xmlhttp_confirm_assign==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  }
		var url="ajax_confirm_assignment.php";
		url=url+"?id="+trip_id;
		xmlhttp_confirm_assign.onreadystatechange=function (){
		  if (xmlhttp_confirm_assign.readyState==4)
		  {
			if(xmlhttp_confirm_assign.responseText=="1")
			{
			redirectFrame("bodyFrame","dashboard.php")
			closePopDiv();
			alert('Successfully confirmed trip assignment!');
			}
			else
			{
			alert("Error: ".xmlhttp_confirm_assign.responseText);
			}
		  }
		}
		xmlhttp_confirm_assign.open("GET",url,true);
		xmlhttp_confirm_assign.send(null);	
	}
}
</script>
<style>
#hor-minimalist-b th {
    border-bottom: 2px solid #5F0C0C ;
    color: #5F0C0C;
    font-size: 12px;
    font-weight: bold;
    padding: 10px 8px;
}
</style>
</head>
<body id='index_body'>
<div id="pop_div" class="pop"></div>
<div id="disableDiv"></div>
<div id='container' class="container">
<div id='header_bar' class="redBar">
	<!--<img class="headerLogo" src="image/banner_nn.png" />-->
	<img class="headerLogo" src="image/nn_banner.png" />
	<div id="div_datetime" style="position:relative;z-index:5;color:#FFFFFF;top:-15px;text-align:right;padding-right:10px;font-weight:bold;"></div>
</div>

<ul id="nav">
	<li class="top_nav">
		<a href="#" onClick=redirectFrame("bodyFrame","dashboard.php")>Home</a>
	</li>
	<li>
		<a href="#" onClick=redirectFrame("bodyFrame","trucker_queue_list.php")>TAS</a>
	</li>
	<li>
		<a href="#" onClick=redirectFrame("bodyFrame","trucker_truck_list.php")>Truck</a>
	</li>
	<li>
		<a href="#" onClick=redirectFrame("bodyFrame","trucker_archive_list.php")>Archive</a>
	</li>
</ul>
<ul id="nav2">
	<li>
		<a href="#">Account&nbsp;&nbsp;</a>
		<ul>
			<li><a href="#">Settings&nbsp;&nbsp;</a></li>
			<li><a href="#" onClick=ajaxLogout()>Logout&nbsp;&nbsp;</a></li>
		</ul>
	</li>
</ul>
<iframe id='bodyFrame' class="bodyFrame" src="dashboard.php"></iframe>
</div>
</body>
</html>